package com.wxapp.common.core.annotation.config;

import com.wxapp.common.constant.properties.LoginProperties;
import com.wxapp.common.core.annotation.resolver.AccessLimitResolver;
import com.wxapp.common.core.annotation.resolver.UserResolver;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * 全局获取用户信息注解
 */
@Configuration
@RequiredArgsConstructor
public class InterceptorConfig implements WebMvcConfigurer {
    private final LoginProperties loginProperties;
    private final RedisTemplate redisTemplate;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(new UserResolver(loginProperties,redisTemplate));
    }

}